package com.cf.web.controller;


import com.cf.web.RequiredLogin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * cf-game-CommomController
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/3/1 18:07
 */
public abstract class PageController {

    //###########################################页面跳转###############################################################

    /**
     * 跳转到list页面
     *
     * @param request
     * @param response
     * @return
     */
    @RequiredLogin
    @RequestMapping(value = {"/page/{path}"}, method = RequestMethod.GET)
    public String listPage(@PathVariable("path") String path, HttpServletRequest request, HttpServletResponse response) {
        return getPageDir() + "/" + path;
    }

    /**
     * 获取视图页面所在的目录
     *
     * @return
     */
    protected abstract String getPageDir();


}
